package com.zmn.oms.business.impl.masterworking;

import com.zmn.oms.business.interfaces.masterworking.MasterWorkingBService;
import com.zmn.oms.business.interfaces.mq.MqProviderService;
import com.zmn.oms.model.entity.masterworking.MasterWorking;
import com.zmn.oms.services.interfaces.masterworking.MasterWorkingService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 类描述：工程师进行中工单
 *
 * @author liuying
 * @date 2021/11/17 10:21
 */
@Service
public class MasterWorkingBServiceImpl implements MasterWorkingBService {

    @Resource
    private MasterWorkingService masterWorkingService;

    //@Reference(version = com.zmn.base.engineer.common.constants.DubboConsts.INTERFACE_VERSION, check = false)
    //private EngineerTouchModifyRemoteService engineerTouchModifyRemoteService;

    @Autowired
    private MqProviderService mqProviderService;

    @Override
    public void updateMasterWorkingWaitCancelStatus(Long workId, Integer waitCancel) {

        // 同步进行中的工程师工单表
        masterWorkingService.updateMasterWorkingStatus(workId, null, null, waitCancel);

        MasterWorking masterWorkingByWorkId = masterWorkingService.findMasterWorkingByWorkId(workId);
        if (masterWorkingByWorkId != null) {
            // 刷新工程师工单列表版本号
            //engineerTouchModifyRemoteService.saveEngineerWorkVersion(masterWorkingByWorkId.getMasterId(), null);
            mqProviderService.sendEngineerWorkVersion(masterWorkingByWorkId.getMasterId(), null);
        }
    }
}
